package com.joysuch.wwyt.bp.enums;

/**
 * 目标考核结果枚举
 *
 * @author xsx
 * @version 1.0
 * @date 2023/4/7 10:47
 */
public enum AssessmentResults {
    outstanding("1", "优秀"),
    good("2", "良好"),
    qualified("3", "合格"),
    unqualified("4", "不合格");

    private String code;
    private String name;

    AssessmentResults(String code, String name) {
        this.code = code;
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public static String getNameByCode(String code) {
        AssessmentResults[] values = AssessmentResults.values();
        for (AssessmentResults value : values) {
            if (value.code.equals(code)) {
                return value.name;
            }
        }
        return null;
    }

    public static String getCodeByName(String name) {
        AssessmentResults[] values = AssessmentResults.values();
        for (AssessmentResults value : values) {
            if (value.name.equals(name)) {
                return value.code;
            }
        }
        return null;
    }
}
